/*
https://leetcode.cn/problems/find-the-power-of-k-size-subarrays-ii/description/?envType=problem-list-v2&envId=AnEpLQwV
3255. 长度为 K 的子数组的能量值 II
*/

class Solution {
public:
    vector<int> resultsArray(vector<int>& nums, int k) {
        int cnt=0;
        int n=nums.size();
        vector<int>arr(n-k+1,-1);
        for(int i=0;i<n;i++)
        {
            if(i==0) cnt=1;
            else
            nums[i]-nums[i-1]==1?cnt++:cnt=1;
            if(cnt>=k)
            arr[i-k+1]=nums[i];
        }
        return arr;
    }
};